{include file="public/header" /}
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>{$Think.lang.fuwu_grade}</h3>
                <h5></h5>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>
        <form id="form" method="post" name="form1">
            <input type="hidden" name="id" value="{$data.id}" id="id"/>
            <input type="hidden" name="admin_id" value="{$data.admin_id}" id="admin_id"/>
            <table class="ds-default-table">
                <tbody>
                <tr class="noborder">
                    <td class="required w120"><label class="validation">{$Think.lang.fuwu_grade_name}:</label></td>
                    <td class="vatop rowform"><input type="text" value="{$data.name}" name="name" id="name" class="txt"></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required">{$Think.lang.fuwu_grade_desc}</td>
                    {:build_editor(['name'=>'desc','content'=>htmlspecialchars_decode($data.desc)])}
                    <td class="vatop rowform" colspan="2"><textarea name="desc" id="desc" style="width:100%;"></textarea></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label>{$Think.lang.fuwu_grade_status}: </label></td>
                    <td class="vatop rowform onoff">
                        <label for="status1" class="cb-enable {if $data.status == '1'}selected{/if}" title="{$Think.lang.fuwu_grade_status1}"><span>{$Think.lang.fuwu_grade_status1}</span></label>
                        <label for="status0" class="cb-disable {if $data.status == '0'}selected{/if}" title="{$Think.lang.fuwu_grade_status0}"><span>{$Think.lang.fuwu_grade_status0}</span></label>
                        <input id="status1" name="status" {if $data.status == '1'}checked="checked"{/if} value="1" type="radio">
                        <input id="status0" name="status" {if $data.status == '0'}checked="checked"{/if} value="0" type="radio">
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label>{$Think.lang.fuwu_grade_admin_name}: </label></td>
                    <td class="vatop rowform"><input type="text" value="{$data.admin_name}" name="admin_name" id="admin_name" class="txt" readonly="readonly"></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label>{$Think.lang.fuwu_grade_createdtime}: </label></td>
                    <td class="vatop rowform"><input type="text" value="{$data.created_at}" name="created_at" id="created_at" class="txt" readonly="readonly" ></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label>{$Think.lang.fuwu_grade_updatedtime}: </label></td>
                    <td class="vatop rowform"><input type="text" value="{$data.updated_at}" name="updated_at" id="updated_at" class="txt" readonly="readonly" ></td>
                    <td class="vatop tips"></td>
                </tr>

                </tbody>
                <tfoot>
                <tr class="tfoot">
                    <td colspan="15" ><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
                </tr>
                </tfoot>
            </table>
        </form>
    </div>
<script src="{$Think.PLUGINS_SITE_ROOT}/mlselection.js"></script>
<script>
//按钮先执行验证再提交表
    $(document).ready(function () {
        $("#form").validate({

        errorPlacement: function (error,element) {
                error.appendTo(element.parent().parent().find('td:last'));
            },
            rules:{
                name:{
                    required:true,
                    minlength:2,
                    remote:{
                        url:ADMINSITEURL+'/Fugrade/ajax.html?branch=check_name',
                        type:'get',
                        data:{
                            name:function () {
                             return $('#name').val();
                            },
                            id:function () {
                                return $('#id').val();
                            }
                        }
                    }
                },
            },
            messages:{
                name:{
                    required:'{$Think.lang.fuwu_grade_name_bi}',
                    minlength:'{$Think.lang.fuwu_grade_name_max}',
                    remote:'{$Think.lang.fuwu_grade_name_unique}',
                },
            }
        });
    });
</script>